package com.ww.scm.entity.mat;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.ww.scm.entity.AbstractEntity;
import com.ww.scm.entity.pub.Dictionary;

@Entity
@Table(name = "T_MAT_BILL")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// 业务单据
public class Bill extends AbstractEntity {

	// 单据编号
	private String billCode;
	// 单据日期
	private String billDate;
	// 单据类型
	private Dictionary billType;
	// 填报人
	private String operator;
	// 填报时间
	private String fillTime;
	// 源位置
	private Dictionary originEntity;
	// 目目标位置
	private Dictionary targetEntity;
	// 事务
	private List<Transaction> transaction=new ArrayList<Transaction>(0);

    private Dictionary otherDic1;
	
	private Dictionary otherDic2;
	
	private Dictionary otherDic3;
	
	private Dictionary otherDic4;
	
	private Dictionary otherDic5;
	
	private Dictionary otherDic6;
	
	private Dictionary otherDic7;
	
	private Dictionary otherDic8;
	
	private Dictionary otherDic9;
	
	private Dictionary otherDic10;
	
	private String value1;
	private String value2;
	private String value3;
	private String value4;
	private String value5;
	private String value6;
	private String value7;
	private String value8;
	private String value9;
	private String value10;
	
	private Double double1;
	private Double double2;
	private Double double3;
	private Double double4;
	private Double double5;
	private Double double6;
	private Double double7;
	private Double double8;
	private Double double9;
	private Double double10;	
	
	public Bill() {
	}

	public Bill(Dictionary billType) {
		this.billType = billType;
	}
	
	@Transient
	public void addTransaction(Transaction transaction) {
		this.transaction.add(transaction);
	}
	@Transient
	public Transaction getLastTransaction() {
		return transaction.get(transaction.size()-1);
	}

	@Column(name = "F_BILL_CODE", nullable = false, unique = true, length = 128)
	public String getBillCode() {
		return billCode;
	}

	@Column(name = "F_BILL_DATE", nullable = false, length = 8)
	public String getBillDate() {
		return billDate;
	}

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_BILL_TYPE_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Dictionary getBillType() {
		return billType;
	}

	@Column(name = "F_OPERATOR", length = 32)
	public String getOperator() {
		return operator;
	}

	@Column(name = "F_FILL_TIME", nullable = true,length = 8)
	public String getFillTime() {
		return fillTime;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_ORIGIN_ENTITY_ID") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Dictionary getOriginEntity() {
		return originEntity;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_TARGET_ENTITY_ID") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Dictionary getTargetEntity() {
		return targetEntity;
	}

	@OneToMany(mappedBy = "bill", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
	//@IndexColumn(name = "F_ORDER",nullable = true,base = 1)
	@OrderBy("createTime")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<Transaction> getTransaction() {
		return transaction;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID1") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic1() {
		return otherDic1;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID2") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic2() {
		return otherDic2;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID3") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic3() {
		return otherDic3;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID4") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic4() {
		return otherDic4;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID5") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic5() {
		return otherDic5;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID6") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic6() {
		return otherDic6;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID7") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic7() {
		return otherDic7;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID8") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic8() {
		return otherDic8;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID9") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic9() {
		return otherDic9;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 
	@JoinColumn(name = "F_OTHER_DIC_ID10") 
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getOtherDic10() {
		return otherDic10;
	}
	
	@Column(name = "F_VALUE1", length = 500)
	public String getValue1() {
		return value1;
	}

	@Column(name = "F_VALUE2", length = 500)
	public String getValue2() {
		return value2;
	}
	@Column(name = "F_VALUE3", length = 500)
	public String getValue3() {
		return value3;
	}
	@Column(name = "F_VALUE4", length = 500)
	public String getValue4() {
		return value4;
	}
	
	@Column(name = "F_VALUE5", length = 500)
	public String getValue5() {
		return value5;
	}
	
	@Column(name = "F_VALUE6", length = 500)
	public String getValue6() {
		return value6;
	}
	
	@Column(name = "F_VALUE7", length = 500)
	public String getValue7() {
		return value7;
	}
	
	@Column(name = "F_VALUE8", length = 500)
	public String getValue8() {
		return value8;
	}
	
	@Column(name = "F_VALUE9", length = 500)
	public String getValue9() {
		return value9;
	}
	
	@Column(name = "F_VALUE10", length = 500)
	public String getValue10() {
		return value1;
	}
	
	@Column(name = "F_DOUBLE1",   precision = 12, scale = 4)
	public Double getDouble1() {
		return double1;
	}
	
	@Column(name = "F_DOUBLE2",   precision = 12, scale = 4)
	public Double getDouble2() {
		return double2;
	}
	
	@Column(name = "F_DOUBLE3",   precision = 12, scale = 4)
	public Double getDouble3() {
		return double3;
	}
	
	@Column(name = "F_DOUBLE4",   precision = 12, scale = 4)
	public Double getDouble4() {
		return double4;
	}
	
	@Column(name = "F_DOUBLE5",   precision = 12, scale = 4)
	public Double getDouble5() {
		return double5;
	}
	
	@Column(name = "F_DOUBLE6",   precision = 12, scale = 4)
	public Double getDouble6() {
		return double6;
	}
	
	@Column(name = "F_DOUBLE7",   precision = 12, scale = 4)
	public Double getDouble7() {
		return double7;
	}
	
	@Column(name = "F_DOUBLE8",   precision = 12, scale = 4)
	public Double getDouble8() {
		return double8;
	}
	
	@Column(name = "F_DOUBLE9",   precision = 12, scale = 4)
	public Double getDouble9() {
		return double9;
	}
	
	@Column(name = "F_DOUBLE10",   precision = 12, scale = 4)
	public Double getDouble10() {
		return double10;
	}
	
	public void setBillCode(String billCode) {
		this.billCode = billCode;
	}

	public void setBillDate(String billDate) {
		this.billDate = billDate;
	}

	public void setBillType(Dictionary billType) {
		this.billType = billType;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public void setFillTime(String fillTime) {
		this.fillTime = fillTime;
	}

	public void setOriginEntity(Dictionary originEntity) {
		this.originEntity = originEntity;
	}

	public void setTargetEntity(Dictionary targetEntity) {
		this.targetEntity = targetEntity;
	}

	public void setTransaction(List<Transaction> transaction) {
		this.transaction = transaction;
	}
	
	public void setOtherDic1(Dictionary other1) {
		this.otherDic1 = other1;
	}
	
	public void setOtherDic2(Dictionary other2) {
		this.otherDic2 = other2;
	}
	public void setOtherDic3(Dictionary other3) {
		this.otherDic3 = other3;
	}
	
	public void setOtherDic4(Dictionary other4) {
		this.otherDic4 = other4;
	}
	
	public void setOtherDic5(Dictionary other5) {
		this.otherDic5 = other5;
	}
	
	public void setOtherDic6(Dictionary other6) {
		this.otherDic6 = other6;
	}
	
	public void setOtherDic7(Dictionary other7) {
		this.otherDic7 = other7;
	}
	
	public void setOtherDic8(Dictionary other8) {
		this.otherDic8 = other8;
	}
	
	public void setOtherDic9(Dictionary other9) {
		this.otherDic9 = other9;
	}
	
	public void setOtherDic10(Dictionary other10) {
		this.otherDic10 = other10;
	}

	public void setValue1(String value1) {
		this.value1 = value1;
	}
	
	public void setValue2(String value2) {
		this.value2 = value2;
	}

	public void setValue3(String value3) {
		this.value3 = value3;
	}

	public void setValue4(String value4) {
		this.value4 = value4;
	}

	public void setValue5(String value5) {
		this.value5 = value5;
	}

	public void setValue6(String value6) {
		this.value6 = value6;
	}

	public void setValue7(String value7) {
		this.value7 = value7;
	}

	public void setValue8(String value8) {
		this.value8 = value8;
	}

	public void setValue9(String value9) {
		this.value9 = value9;
	}

	public void setValue10(String value10) {
		this.value10 = value10;
	}
	
	public void setDouble1(Double double1) {
		this.double1 = double1;
	}
	
	public void setDouble2(Double double2) {
		this.double2 = double2;
	}

	public void setDouble3(Double double3) {
		this.double3 = double3;
	}

	public void setDouble4(Double double4) {
		this.double4 = double4;
	}

	public void setDouble5(Double double5) {
		this.double5 = double5;
	}

	public void setDouble6(Double double6) {
		this.double6 = double6;
	}

	public void setDouble7(Double double7) {
		this.double7 = double7;
	}

	public void setDouble8(Double double8) {
		this.double8 = double8;
	}

	public void setDouble9(Double double9) {
		this.double9 = double9;
	}

	public void setDouble10(Double double10) {
		this.double10 = double10;
	}


}
